home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / manual / Makefile < prev    next >
Makefile  |  1994-01-27  |  5KB  |  186 lines

  1. # Makefile for the GNU C Library manual.
  2.  
  3. # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  4. # This file is part of the GNU C Library.
  5.  
  6. # The GNU C Library is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Library General Public License
  8. # as published by the Free Software Foundation; either version 2 of
  9. # the License, or (at your option) any later version.
  10.  
  11. # The GNU C Library is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # Library General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with the GNU C Library; see the file COPYING.LIB.  If
  18. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  19. # Cambridge, MA 02139, USA.
  20.  
  21. subdir := manual
  22. export subdir := $(subdir)
  23.  
  24. .PHONY: all dvi info
  25. all: dvi info
  26. dvi: libc.dvi
  27. info: libc.info
  28.  
  29. # Get glibc's configuration info.
  30. ifneq (,$(wildcard ../Makeconfig))
  31. include ../Makeconfig
  32. endif
  33.  
  34. # Set chapters and chapters-incl.
  35. include chapters
  36. chapters: libc.texinfo
  37.     $(find-includes)
  38. chapters := $(filter-out summary.texi,$(chapters))
  39. ifdef chapters
  40. include chapters-incl
  41. chapters-incl: $(chapters)
  42.     $(find-includes)
  43. endif
  44.  
  45. define find-includes
  46. (echo '$(@F) :=' \\    ;\
  47.  awk '$$1 == "@include" { print $$2 " \\" }' $^) > $@.new
  48. mv -f $@.new $@
  49. endef
  50.  
  51. libc.dvi libc.info: $(chapters) summary.texi $(chapters-incl)
  52. libc.dvi: texinfo.tex
  53.  
  54. # Generate the summary from the Texinfo source files for each chapter.
  55. summary.texi: stamp-summary ;
  56. stamp-summary: summary.awk $(chapters)
  57.     awk -f $^ \
  58.     | sort -df +1 -2 | tr '\014' '\012' > summary-tmp
  59.     ./move-if-change summary-tmp summary.texi
  60. # touch is broken on our machines.  Sigh.
  61.     date > $@
  62.  
  63. # Generate Texinfo files from the C source for the example programs.
  64. %.c.texi: examples/%.c
  65.     sed -e 's,[{}],@&,g'                \
  66.         -e 's,/\*\(@.*\)\*/,\1,g'            \
  67.         -e 's,/\*  *,/* @r{,g' -e 's,  *\*/,} */,'    \
  68.         -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/'\
  69.         $< | expand > $@.new
  70.     mv -f $@.new $@
  71.  
  72.  
  73. minimal-dist = summary.awk move-if-change libc.texinfo $(chapters)    \
  74.            $(patsubst %.c.texi,examples/%.c,            \
  75.               $(filter-out summary.texi,$(chapters-incl)))
  76. doc-only-dist = Makefile COPYING.LIB mkinstalldirs
  77. distribute = $(minimal-dist)                               \
  78.          $(patsubst examples/%.c,%.c.texi,$(filter examples/%.c,    \
  79.             $(minimal-dist)))                \
  80.          libc.?? libc.??s texinfo.tex summary.texi            \
  81.          stamp-summary chapters chapters-incl
  82. export distribute := $(distribute)
  83.  
  84. tar-it = tar chovf $@ $^
  85.  
  86. manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
  87. mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
  88.  
  89. edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
  90.                libc.texinfo)
  91.  
  92. glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
  93.     @rm -f glibc-doc-$(edition)
  94.     ln -s . glibc-doc-$(edition)
  95.     tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
  96.     rm -f glibc-doc-$(edition)
  97.  
  98. %.Z: %
  99.     compress -c $< > $@.new
  100.     mv -f $@.new $@
  101. %.gz: %
  102.     gzip -9 -c $< > $@.new
  103.     mv -f $@.new $@
  104. %.uu: %
  105.     uuencode $< < $< > $@.new
  106.     mv -f $@.new $@
  107.  
  108. # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
  109. subdir_%: % ;
  110.  
  111. .PHONY: mostlyclean distclean realclean clean
  112. mostlyclean:
  113.     -rm -f libc.dvi libc.info*
  114. clean: mostlyclean
  115. distclean: clean
  116. realclean: distclean
  117.     -rm -f chapters chapters-incl summary.texi stamp-summary *.c.texi
  118.     -rm -f libc.cp libc.cps libc.fn libc.fns libc.pg libc.pgs \
  119.            libc.tp libc.tps libc.vr libc.vrs libc.log libc.aux libc.toc
  120.  
  121. .PHONY: install subdir_install installdirs install-data
  122. install-data subdir_install: install
  123. install: $(infodir)/libc.info
  124. # Catchall implicit rule for other installation targets from the parent.
  125. install-%: ;
  126.  
  127. ifndef infodir
  128. infodir = $(prefix)/info
  129. endif
  130. ifndef prefix
  131. prefix = /usr/local
  132. endif
  133.  
  134. ifndef INSTALL_DATA
  135. INSTALL_DATA = $(INSTALL) -m 644
  136. endif
  137. ifndef INSTALL
  138. INSTALL = install
  139. endif
  140.  
  141. $(infodir)/libc.info: libc.info installdirs
  142.     for file in $<*; do \
  143.       name=`basename $$file`; \
  144.       $(INSTALL_DATA) $$file \
  145.         `echo $@ | sed "s,$<\$$,$$name,"`; \
  146.     done
  147.  
  148. installdirs: $(firstword $(wildcard mkinstalldirs ../mkinstalldirs))
  149.     $(dir $<)$(notdir $<) $(infodir)
  150.  
  151. .PHONY: dist
  152. dist: # glibc-doc-$(edition).tar.gz
  153.  
  154. ifneq (,$(wildcard ../Make-dist))
  155. dist: ../Make-dist
  156.     $(MAKE) -f $< $(Make-dist-args)
  157. endif
  158.  
  159. ifndef ETAGS
  160. ETAGS = etags -T
  161. endif
  162. TAGS: $(minimal-dist)
  163.     $(ETAGS) -o $@ $^
  164.  
  165. # These are targets that each glibc subdirectory is expected to understand.
  166. # ../Rules defines them for code subdirectories; for us, they are no-ops.
  167. glibc-targets    := subdir_lib objects objs others tests subdir_lint.out \
  168.            subdir_echo-headers subdir_echo-distinfo stubs
  169. .PHONY: $(glibc-targets)
  170. $(glibc-targets):
  171.  
  172. stubs: $(common-objpfx)stub-manual
  173. $(common-objpfx)stub-manual:
  174.     cp /dev/null $@
  175.  
  176. # The top-level glibc Makefile expects subdir_install to update the stubs file.
  177. subdir_install: stubs
  178.  
  179.  
  180. # Get rid of these variables if they came from the parent.
  181. routines =
  182. aux =
  183. sources =
  184. objects =
  185. headers =
  186.